/**
 */
package proyecto.testcasetool.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import proyecto.testcasetool.Parameter;
import proyecto.testcasetool.SingularInvalidValue;
import proyecto.testcasetool.SingularValidValue;
import proyecto.testcasetool.TestcasetoolPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Parameter</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getName <em>Name</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getDescription <em>Description</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getType <em>Type</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getCondition <em>Condition</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getDatatype <em>Datatype</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getValidity <em>Validity</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getSingularInvalidValue <em>Singular Invalid Value</em>}</li>
 *   <li>{@link proyecto.testcasetool.impl.ParameterImpl#getSingularValidValue <em>Singular Valid Value</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ParameterImpl extends EObjectImpl implements Parameter {
	/**
	 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected static final String NAME_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName()
	 * @generated
	 * @ordered
	 */
	protected String name = NAME_EDEFAULT;

	/**
	 * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected static final String DESCRIPTION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDescription()
	 * @generated
	 * @ordered
	 */
	protected String description = DESCRIPTION_EDEFAULT;

	/**
	 * The default value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected static final String TYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getType()
	 * @generated
	 * @ordered
	 */
	protected String type = TYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getCondition() <em>Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCondition()
	 * @generated
	 * @ordered
	 */
	protected static final String CONDITION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getCondition() <em>Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCondition()
	 * @generated
	 * @ordered
	 */
	protected String condition = CONDITION_EDEFAULT;

	/**
	 * The default value of the '{@link #getDatatype() <em>Datatype</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDatatype()
	 * @generated
	 * @ordered
	 */
	protected static final String DATATYPE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDatatype() <em>Datatype</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDatatype()
	 * @generated
	 * @ordered
	 */
	protected String datatype = DATATYPE_EDEFAULT;

	/**
	 * The default value of the '{@link #getValidity() <em>Validity</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValidity()
	 * @generated
	 * @ordered
	 */
	protected static final String VALIDITY_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getValidity() <em>Validity</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getValidity()
	 * @generated
	 * @ordered
	 */
	protected String validity = VALIDITY_EDEFAULT;

	/**
	 * The cached value of the '{@link #getSingularInvalidValue() <em>Singular Invalid Value</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSingularInvalidValue()
	 * @generated
	 * @ordered
	 */
	protected EList<SingularInvalidValue> singularInvalidValue;

	/**
	 * The cached value of the '{@link #getSingularValidValue() <em>Singular Valid Value</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSingularValidValue()
	 * @generated
	 * @ordered
	 */
	protected EList<SingularValidValue> singularValidValue;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ParameterImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TestcasetoolPackage.Literals.PARAMETER;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getName() {
		return name;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setName(String newName) {
		String oldName = name;
		name = newName;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__NAME, oldName, name));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDescription(String newDescription) {
		String oldDescription = description;
		description = newDescription;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__DESCRIPTION, oldDescription, description));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getType() {
		return type;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setType(String newType) {
		String oldType = type;
		type = newType;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__TYPE, oldType, type));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getCondition() {
		return condition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCondition(String newCondition) {
		String oldCondition = condition;
		condition = newCondition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__CONDITION, oldCondition, condition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDatatype() {
		return datatype;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDatatype(String newDatatype) {
		String oldDatatype = datatype;
		datatype = newDatatype;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__DATATYPE, oldDatatype, datatype));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getValidity() {
		return validity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setValidity(String newValidity) {
		String oldValidity = validity;
		validity = newValidity;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TestcasetoolPackage.PARAMETER__VALIDITY, oldValidity, validity));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SingularInvalidValue> getSingularInvalidValue() {
		if (singularInvalidValue == null) {
			singularInvalidValue = new EObjectContainmentEList<SingularInvalidValue>(SingularInvalidValue.class, this, TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE);
		}
		return singularInvalidValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SingularValidValue> getSingularValidValue() {
		if (singularValidValue == null) {
			singularValidValue = new EObjectContainmentEList<SingularValidValue>(SingularValidValue.class, this, TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE);
		}
		return singularValidValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE:
				return ((InternalEList<?>)getSingularInvalidValue()).basicRemove(otherEnd, msgs);
			case TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE:
				return ((InternalEList<?>)getSingularValidValue()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TestcasetoolPackage.PARAMETER__NAME:
				return getName();
			case TestcasetoolPackage.PARAMETER__DESCRIPTION:
				return getDescription();
			case TestcasetoolPackage.PARAMETER__TYPE:
				return getType();
			case TestcasetoolPackage.PARAMETER__CONDITION:
				return getCondition();
			case TestcasetoolPackage.PARAMETER__DATATYPE:
				return getDatatype();
			case TestcasetoolPackage.PARAMETER__VALIDITY:
				return getValidity();
			case TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE:
				return getSingularInvalidValue();
			case TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE:
				return getSingularValidValue();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TestcasetoolPackage.PARAMETER__NAME:
				setName((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__DESCRIPTION:
				setDescription((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__TYPE:
				setType((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__CONDITION:
				setCondition((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__DATATYPE:
				setDatatype((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__VALIDITY:
				setValidity((String)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE:
				getSingularInvalidValue().clear();
				getSingularInvalidValue().addAll((Collection<? extends SingularInvalidValue>)newValue);
				return;
			case TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE:
				getSingularValidValue().clear();
				getSingularValidValue().addAll((Collection<? extends SingularValidValue>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.PARAMETER__NAME:
				setName(NAME_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__DESCRIPTION:
				setDescription(DESCRIPTION_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__TYPE:
				setType(TYPE_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__CONDITION:
				setCondition(CONDITION_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__DATATYPE:
				setDatatype(DATATYPE_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__VALIDITY:
				setValidity(VALIDITY_EDEFAULT);
				return;
			case TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE:
				getSingularInvalidValue().clear();
				return;
			case TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE:
				getSingularValidValue().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TestcasetoolPackage.PARAMETER__NAME:
				return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
			case TestcasetoolPackage.PARAMETER__DESCRIPTION:
				return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
			case TestcasetoolPackage.PARAMETER__TYPE:
				return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
			case TestcasetoolPackage.PARAMETER__CONDITION:
				return CONDITION_EDEFAULT == null ? condition != null : !CONDITION_EDEFAULT.equals(condition);
			case TestcasetoolPackage.PARAMETER__DATATYPE:
				return DATATYPE_EDEFAULT == null ? datatype != null : !DATATYPE_EDEFAULT.equals(datatype);
			case TestcasetoolPackage.PARAMETER__VALIDITY:
				return VALIDITY_EDEFAULT == null ? validity != null : !VALIDITY_EDEFAULT.equals(validity);
			case TestcasetoolPackage.PARAMETER__SINGULAR_INVALID_VALUE:
				return singularInvalidValue != null && !singularInvalidValue.isEmpty();
			case TestcasetoolPackage.PARAMETER__SINGULAR_VALID_VALUE:
				return singularValidValue != null && !singularValidValue.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (name: ");
		result.append(name);
		result.append(", description: ");
		result.append(description);
		result.append(", type: ");
		result.append(type);
		result.append(", condition: ");
		result.append(condition);
		result.append(", datatype: ");
		result.append(datatype);
		result.append(", validity: ");
		result.append(validity);
		result.append(')');
		return result.toString();
	}

} //ParameterImpl
